home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / toolkit / vbof_v11 / demostat.cls < prev    next >
Encoding:
Text File  |  1996-03-01  |  3.1 KB  |  105 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "State"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = True
  8. Option Explicit
  9.  
  10. ' the following pertain to being supported by
  11. '   VBOFCollection, VBOFObjectManager and
  12. '   VBOFEventManager
  13. Public ObjectID As Long
  14. Public ObjectChanged As Long
  15. Public ObjectAdded As Long
  16. Public ObjectDeleted As Long
  17. Public ObjectParentCount As Long
  18. Public ObjectManager As VBOFObjectManager
  19.  
  20. Public StateCode As String
  21. Public StateName As String
  22. Public CapitalCity As String
  23. Public Population As Long
  24.  
  25. Public Function ObjectSortCompare(Optional SortField As Variant, Optional SortOrder As Variant, Optional CompareObject As Variant) As Long
  26. ' Support the Collection.Sort method
  27. ' Note: use the ObjectManager.ObjectSortCompare
  28. '   method for assistance
  29.  
  30.     Select Case SortField
  31.         Case "StateCode"
  32.             ObjectSortCompare = _
  33.                 ObjectManager.ObjectSortCompare( _
  34.                     Value1:=StateCode, _
  35.                     Value2:=CompareObject.StateCode, _
  36.                     SortOrder:=SortOrder)
  37.         
  38.         Case "Population"
  39.             ObjectSortCompare = _
  40.                 ObjectManager.ObjectSortCompare( _
  41.                     Value1:=Format$(Population, "000000000"), _
  42.                     Value2:=Format$(CompareObject.LastName, "000000000"), _
  43.                     SortOrder:=SortOrder)
  44.         
  45.         Case "CapitalCity"
  46.             ObjectSortCompare = _
  47.                 ObjectManager.ObjectSortCompare( _
  48.                     Value1:=CapitalCity, _
  49.                     Value2:=CompareObject.CapitalCity, _
  50.                     SortOrder:=SortOrder)
  51.         
  52.         Case "StateName"
  53.             ObjectSortCompare = _
  54.                 ObjectManager.ObjectSortCompare( _
  55.                     Value1:=StateName, _
  56.                     Value2:=CompareObject.StateName, _
  57.                     SortOrder:=SortOrder)
  58.     End Select
  59.  
  60. End Function
  61.  
  62.  
  63.  
  64. Public Function ObjectInitializeFromRecordSet(Optional RecordSet As Variant) As Address
  65. ' Populate my variables from the RecordSet
  66. '   (in support of VBOFCollection)
  67.  
  68.     On Local Error Resume Next
  69.     
  70.     StateCode = RecordSet("StateCode") & ""
  71.     StateName = RecordSet("StateName") & ""
  72.     CapitalCity = RecordSet("CapitalCity") & ""
  73.     Population = RecordSet("Population") + 0
  74.     
  75.     ObjectID = RecordSet("ObjectID")
  76.  
  77.     Set ObjectInitializeFromRecordSet = Me
  78. End Function
  79.  
  80. Public Function ObjectListBoxValue() As String
  81. ' Return a String will represent this object
  82. '   in a ListBox
  83. '   (in support of VBOFCollection)
  84.  
  85.     ObjectListBoxValue = _
  86.         StateCode & " (" & StateName & ")"
  87.  
  88. End Function
  89.  
  90. Public Function ObjectNewInstanceOfMyClass() As State
  91. ' Return a new instance of this class
  92. '   (in support of VBOFCollection)
  93.  
  94.     Set ObjectNewInstanceOfMyClass = New State
  95. End Function
  96.  
  97. Public Function ObjectDataSource() As String
  98. ' Return the Data Source with which this Class is associated
  99. '   (in support of VBOFCollection)
  100.     
  101.     ObjectDataSource = "States"
  102. End Function
  103.  
  104.  
  105.